// File:    Empresa.cs
// Author:  Lucas Bittencourt
// Created: segunda-feira, 7 de novembro de 2011 20:48:44
// Purpose: Definition of Class Empresa

using System;
using System.Text;

namespace DA_OOMModel
{
   public class Empresa
   {
       private int empIdEmpresa;
       private string empNmEmpresa;
       private string empNuCnpj;

       private Iesi.Collections.ISet contaBancaria;
      
      /// <summary>
      /// Property for collection of ContaBancaria
      /// </summary>
      /// <pdGenerated>Default opposite class collection property</pdGenerated>
      public virtual Iesi.Collections.ISet ContaBancaria
      {
         get
         {
            return contaBancaria;
         }
         set
         {
            this.contaBancaria = value;         
         }
      }
   
      /// <summary>
      /// Get value of property EmpIdEmpresa.
      /// </summary>
      public virtual int EmpIdEmpresa
      {
         get
         {
            return empIdEmpresa;
         }
         set
         {
            if (this.empIdEmpresa != value)
               this.empIdEmpresa = value;
         }
      }
      
      /// <summary>
      /// Get value of property EmpNmEmpresa.
      /// </summary>
      public virtual string EmpNmEmpresa
      {
         get
         {
            return empNmEmpresa;
         }
         set
         {
            if (this.empNmEmpresa != value)
               this.empNmEmpresa = value;
         }
      }
      
      /// <summary>
      /// Get value of property EmpNuCnpj.
      /// </summary>
      public virtual string EmpNuCnpj
      {
         get
         {
            return empNuCnpj;
         }
         set
         {
            if (this.empNuCnpj != value)
               this.empNuCnpj = value;
         }
      }
   
      /// <summary>
      /// Get and set primary key class
      /// </summary>
      public virtual EmpresaPK EmpresaPK
      {
         get 
         {
            return new EmpresaPK(empIdEmpresa);
         }
         set
         {
            if (value != null)
            {
               this.empIdEmpresa = value.EmpIdEmpresa;
            }
         }
      }
   
      /// <summary>
      /// Get hash code
      /// </summary>
      /// <pdGenerated>Get hash code</pdGenerated>
      public override int GetHashCode()
      {
         int _hashCode = 0;
         _hashCode = 29 * EmpresaPK.GetHashCode();
         if (this.empNmEmpresa != null) 
            _hashCode += 29 * empNmEmpresa.GetHashCode();
      
         if (this.empNuCnpj != null) 
            _hashCode += 29 * empNuCnpj.GetHashCode();
         return _hashCode;
      }
   
      /// <summary>
      /// Test if two objects are equal
      /// </summary>
      /// <param name="object">Object to compare</param>
      /// <pdGenerated>Test if two objects are equal</pdGenerated>
      public override bool Equals(object obj)
      {
         if (obj == null)
            return false;
         Empresa cast = obj as Empresa;
         if (!(obj is Empresa))
            return false;
         if (!this.EmpresaPK.Equals(cast.EmpresaPK))
            return false;
         if (this.empIdEmpresa != cast.EmpIdEmpresa)
            return false;
         if (String.Equals(this.empNmEmpresa, cast.EmpNmEmpresa) == false)
            return false;
      
         if (String.Equals(this.empNuCnpj, cast.EmpNuCnpj) == false)
            return false;
      
      
         return true;
      }
   
      /// <summary>
      /// Get object in string format
      /// </summary>
      /// <pdGenerated>Get object in string format</pdGenerated>
      public override string ToString()
      {
         StringBuilder ret = new StringBuilder();
         ret.Append( "Empresa: " );
         ret.Append( "EmpIdEmpresa='" + empIdEmpresa.ToString() + "'");
         if (empNmEmpresa != null)
            ret.Append( "EmpNmEmpresa='" + empNmEmpresa.ToString() + "'");
         if (empNuCnpj != null)
            ret.Append( "EmpNuCnpj='" + empNuCnpj.ToString() + "'");
         return ret.ToString();
      }
   
   }
}